package com.zlfund.cat.zjgsmk.util;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestListener;
import com.zlfund.cat.zjgsmk.option.GlideApp;

import java.io.File;

/**
 * Created by chenj
 * Created on 2017/8/15
 */

public class GlideUtil {
    public static void loadUrl(Context context, String imgUrl, ImageView iv){
        GlideApp.with(context)
                .load(imgUrl)
                .into(iv);
    }

    public static void loadUrl(Context context, String imgUrl,Drawable placeImage, ImageView iv){
        GlideApp.with(context)
                .load(imgUrl)
                .placeholder(placeImage)
                .into(iv);
    }

    public static void loadUrl(Context context, String imgUrl,int placeImage, ImageView iv){
        GlideApp.with(context)
                .load(imgUrl)
                .placeholder(placeImage)
                .into(iv);
    }

    public static void loadUrl(Context context, String imgUrl, RequestListener<Drawable> listener){
        GlideApp.with(context)
                .load(imgUrl)
                .listener(listener)
                .submit();

    }

    public static void loadRes(Context context, int resId, ImageView iv){
        GlideApp.with(context)
                .load(resId)
                .into(iv);
    }

    public static void loadFile(Context context, File file, ImageView iv){
        GlideApp.with(context)
                .load(file)
                .into(iv);
    }
}
